home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Prog / T / TIFF Code.cpt / sample.h < prev    next >
Text File  |  1987-12-01  |  3KB  |  135 lines

  1. /* Specifics for non-library modules */
  2.  
  3. /*
  4.  * Types
  5.  */
  6.  
  7. typedef    String(63)    Str63;
  8. typedef union {
  9.     Int16    s;
  10.     Int32    l;
  11. } Int16or32;
  12. typedef Int16or32    *Int16or32Ptr;
  13. typedef Int16        *Int16Ptr;
  14. typedef Int32        *Int32Ptr;
  15. typedef char        *asciiPtr;
  16.  
  17. /* image description type - "id".
  18.  *
  19.  * The structure consists of all known tags at a certain revision of the
  20.  * TIFF specification.  If the size number of items are predetermined by
  21.  * the specification and consist of a reasonably small data item, then they
  22.  * are given space in the structure directly.  If the number of items or
  23.  * the size of the item is unknown, then a pointer to the type is allocated
  24.  * in the structure and it will be necessary to allocate the necessary
  25.  * memory for the tag value or values. */
  26.  
  27. typedef struct {
  28.     Int16            subfileType,        /* 1 SHORT */
  29.                     imageWidth,
  30.                     imageLength;
  31.     Int16Ptr        bitsPerSample,        /* ? SHORTS */
  32.                     compression;
  33.     Int16            photoInterp,        /* 1 SHORT */
  34.                     threshholding,
  35.                     cellWidth,
  36.                     cellLength,
  37.                     fillOrder;
  38.     asciiPtr        docName,            /* ASCII */
  39.                     imageDescription,
  40.                     make,
  41.                     model;
  42.     Int16or32Ptr    stripOffsets;        /* ? SHORTS or LONGS */
  43.     Int16            orientation,        /* 1 SHORT */
  44.                     samplesPerPixel;
  45.     Int32            rowsPerStrip;        /* 1 SHORT or 1 LONG */
  46.     Int32            stripsPerImage;        /* not a tag */
  47.     Int16or32Ptr    stripByteCounts;    /* ? LONGS */
  48.     Int16Ptr        minSampleValue,        /* ? SHORTS */
  49.                     maxSampleValue;
  50.     Rational        xResolution,        /* 1 RATIONAL */
  51.                     yResolution;
  52.     Int16            planarConfig;        /* 1 SHORT */
  53.     asciiPtr        pageName;            /* ASCII */
  54.     Rational        xPosition,            /* 1 Rationals */
  55.                     yPosition;
  56.     Int32Ptr        freeOffsets,
  57.                     freeByteCounts;
  58.     Int16            grayResponseUnit;    /* 1 SHORT */
  59.     Int16Ptr        grayResponseCurve;
  60.     Int32            group3Options,        /* 1 LONG */
  61.                     group4Options;
  62.     Int16            resolutionUnit;        /* 1 SHORT */
  63.     Int16            pageNumber[2];        /* 2 SHORTS */
  64.     Int16            colorResponseUnit;    /* 1 SHORT */
  65.     Int16Ptr        colorResponseCurves;/* ? SHORTS */
  66. } id;
  67.  
  68. /*
  69.  * Macros
  70.  */
  71.  
  72. /* Return minimum of two values */
  73. #define    MIN(a, b)    ((a) < (b) ? (a) : (b))
  74. #define    MAX(a, b)    ((a) > (b) ? (a) : (b))
  75.  
  76. /* Static String Declaration Macro */
  77. #define StatString(name, string)\
  78.         struct {\
  79.             unsigned char length;\
  80.             unsigned char text[sizeof(string)];\
  81.         } name = {\
  82.             sizeof(string) - 1,\
  83.             string\
  84.         }
  85.     
  86. /*
  87.  * Constant Defines
  88.  */
  89.  
  90. /* Creator and Filetype for files we create */
  91. #define    CREATOR        ((OSType)'PUBP')
  92. #define    FILETYPE    ((OSType)'TIFF')
  93.  
  94. /*
  95.  * Routine Declarations
  96.  */
  97.  
  98. void            DoOpen(),
  99.                 DoClose(),
  100.                 DoSave(),
  101.                 DoSaveAs(),
  102.                 DoQuitCleanUp();
  103.         
  104. Boolean            ReadTiff();
  105. void            WriteTiff();
  106.  
  107. Ptr                MyNewPtr();
  108. void            MyDisposPtr();
  109.  
  110. Handle            MyNewHandle();
  111. void            MyDisposHandle();
  112.  
  113. Int16            TypeSize();
  114.  
  115. void            ClipPictToImage(),
  116.                 ImageToClipPict(),
  117.                 ClearImage(),
  118.                 DisplayImage();
  119.                 
  120. Boolean            PutTags();
  121.         
  122. TiffDirEntry    GetDirEntry();
  123.  
  124. /*
  125.  * Debug specific
  126.  */
  127.  
  128. #ifdef DEBUG
  129. void DebugMessage();
  130. #define    DBG(x)    x
  131. #else
  132. #define    DBG(x)
  133. #endif
  134.  
  135.